import request from "@/utils/request";

// 管理员登录
export function login(data) {
	return request({
		url: "/auth/login",
		method: "post",
		data,
	});
}

// 居民登录
export function residentLogin(data) {
	return request({
		url: "/auth/resident-login",
		method: "post",
		data,
	});
}

// 用户注册
export function register(data) {
	return request({
		url: "/auth/register",
		method: "post",
		data,
	});
}

// 修改密码
export function changePassword(data) {
	return request({
		url: "/auth/change-password",
		method: "post",
		headers: {
			"Content-Type": "application/json",
		},
		data: {
			oldPassword: data.oldPassword,
			newPassword: data.newPassword,
		},
	});
}

// 获取当前用户信息
export function getCurrentUser() {
	return request({
		url: "/auth/me",
		method: "get",
	});
}
